using Opo.Net.Mail;
using System.Xml.Serialization;

namespace Opo.Perspective.Core
{
    /// <summary>
    /// Represents information of a contact
    /// </summary>
    [XmlRoot("contactInfo")]
    public class ContactInfo : IContactInfo
    {
        /// <summary>
        /// Gets or sets the type (e.g. "Home", "Work", ...)
        /// </summary>
        /// <value>The type.</value>
        [XmlAttribute("type")]
        public string Type { get; set; }
        /// <summary>
        /// Gets or sets the street.
        /// </summary>
        /// <value>The street.</value>
        [XmlElement("street")]
        public string Street { get; set; }
        /// <summary>
        /// Gets or sets the city information.
        /// </summary>
        /// <value>The city information</value>
        [XmlElement("city")]
        public CityInfo City { get; set; }
        /// <summary>
        /// Gets or sets the email addresses
        /// </summary>
        /// <value>A collection containing the email addresses</value>
        [XmlArray(ElementName = "mailAddresses")]
        [XmlArrayItem(ElementName = "mailAddress", IsNullable = true)]
        public MailAddressCollection MailAddresses { get; set; }
        /// <summary>
        /// Gets or sets the phone numbers
        /// </summary>
        /// <value>The phones.</value>
        [XmlArray(ElementName = "phoneNumbers")]
        [XmlArrayItem(ElementName = "phoneNumber", IsNullable = true)]
        public PhoneNumberCollection PhoneNumbers{ get; set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="ContactInfo"/> class.
        /// </summary>
        public ContactInfo() { }
        /// <summary>
        /// Initializes a new instance of the <see cref="ContactInfo"/> class.
        /// </summary>
        /// <param name="type">The type of this contact info (e.g. "Home", "Work").</param>
        /// <param name="street">The street.</param>
        /// <param name="city">The city.</param>
        /// <param name="emails">The email addresses.</param>
        /// <param name="phones">The phone numbers.</param>
        public ContactInfo(string type, string street, CityInfo city, MailAddressCollection mailAddresses, PhoneNumberCollection phoneNumbers)
        {
            Type = type;
            Street = street;
            City = city;
            MailAddresses = mailAddresses;
            PhoneNumbers = phoneNumbers;
        }
    }
}
